package com.sykj.bsc.zjj.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.sykj.bsc.zjj.bean.Bis_business_order;
import com.sykj.bsc.zjj.bean.Bis_custom_user;
import com.sykj.bsc.zjj.bean.Bis_shop;
import com.sykj.bsc.zjj.bean.Bis_shop_custom;
import com.sykj.bsc.zjj.bean.Bis_shop_post;

/**
 * mapper接口
 * 主表是 Bis_custom_user 顾客用户信息表
 * @author Lenovo G50-80
 *
 */
public interface Bis_custom_userMapper {
	/**
	 * 查询所有
	 * Bis_custom_user
	 * 顾客用户信息表
	 * @param bis_custom_user
	 * @return
	 */
	public List<Map> selectBis_custom_user(Bis_custom_user bis_custom_user);
	
	/**
	 * 查询店铺名称
	 * Bis_shop
	 * 店铺信息表
	 * @return
	 */
	@Select("SELECT * FROM bis_shop")
	public List<Bis_shop> selectBis_shop();
	
	/**
	 * 新增
	 * Bis_custom_user
	 * 顾客用户信息表
	 * @param bis_custom_user
	 */
	@Insert("INSERT INTO bis_custom_user (custom_user_id,mobile,photo,username,sex,nikename,born_date,phone,qq,email,address,remark,enroll_mode,enroll_time,is_del) VALUES(#{custom_user_id},#{mobile},#{photo},#{username},#{sex},#{nikename},#{born_date},#{phone},#{qq},#{email},#{address},#{remark},'3',NOW(),'0')")
	public void insertBis_custom_user(Bis_custom_user bis_custom_user);
	
	/**
	 * 根据ID查询
	 * Bis_custom_user
	 * 顾客用户信息表
	 * @param custom_user_id
	 * @return
	 */
	@Select("SELECT * FROM bis_custom_user WHERE custom_user_id=#{custom_user_id}")
	public Bis_custom_user findByIdBis_custom_user(String custom_user_id);
	
	/**
	 * 修改
	 * Bis_custom_user
	 * 顾客用户信息表
	 * @param bis_custom_user
	 */
	@Update("UPDATE Bis_custom_user SET mobile=#{mobile},photo=#{photo},username=#{username},sex=#{sex},nikename=#{nikename},born_date=#{born_date},phone=#{phone},qq=#{qq},email=#{email},address=#{address},remark=#{remark} WHERE custom_user_id=#{custom_user_id}")
	public void updateBis_custom_user(Bis_custom_user bis_custom_user);
	
	/**
	 * 删除
	 * Bis_custom_user
	 * 顾客用户信息表
	 * @param custom_user_id
	 */
	@Update("UPDATE Bis_custom_user SET is_del='1' WHERE custom_user_id=#{custom_user_id}")
	public void deleteBis_custom_user(String custom_user_id);
	
	/**
	 * 查询
	 * 根据ID查询
	 * Bis_business_order
	 * @param bis_business_order
	 * @return
	 */
	//public List<Bis_business_order> selectBis_business_order(Bis_business_order bbo);
	public List<Map> selectBis_business_order(Bis_business_order bbo);
	
	public List<Map> selectBis_business_order2(Bis_business_order bbo);
	
	/**
	 * 查询
	 * 根据编号查询订单详情
	 * Bis_business_order
	 * @param order_id
	 * @return
	 */
	@Select("SELECT * FROM bis_business_order bbo,bis_shop bs WHERE bbo.shop_id=bs.shop_id AND bbo.order_id=#{order_id}")
	public Bis_business_order selectBis_business_order1(String order_id);
	
	/**
	 * 查询顾客用户信息表
	 * 判断手机是否重复
	 * @param mobile
	 * @return
	 */
	@Select("SELECT COUNT(*) FROM bis_custom_user WHERE mobile=#{mobile}")
	public Integer findByIdBis_custom_usermobile(String mobile);
	
	/**
	 * 查询顾客用户信息表
	 * 判断电话是否重复
	 * @param phone
	 * @return
	 */
	@Select("SELECT COUNT(*) FROM bis_custom_user WHERE phone=#{phone}")
	public Integer findByIdBis_custom_userphone(String phone);
	
	/**
	 * 查询顾客用户信息表
	 * 判断QQ是否重复
	 * @param qq
	 * @return
	 */
	@Select("SELECT COUNT(*) FROM bis_custom_user WHERE qq=#{qq}")
	public Integer findByIdBis_custom_userqq(String qq);
	
	/**
	 * 查询顾客用户信息表
	 * 判断邮箱是否重复
	 * @param email
	 * @return
	 */
	@Select("SELECT COUNT(*) FROM bis_custom_user WHERE email=#{email}")
	public Integer findByIdBis_custom_useremail(String email);
	
}
